home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / patches / pgs3h1.lha / 3.0hUpdate / Macros.LHA / PLcmdshell.rexx < prev    next >
OS/2 REXX Batch file  |  1995-06-12  |  1KB  |  68 lines

  1. /* $VER: Command Shell 1.1 (12.06.95) */
  2.  
  3.  
  4. options results
  5. options failat 100
  6.  
  7. open('console', 'CON:0/11/640/100/PageLiner/SCREEN PageStream3', 'RW')
  8. writeln('console', 'Enter commands, "Q" to exit, "?" for help.')
  9.  
  10. address PAGELINER
  11.  
  12. /* loop until user exits */
  13. do forever
  14.  
  15.     /* get command string from user */
  16.     writech('console','CMD> ')
  17.     cmd=readln('console')
  18.  
  19.     select
  20.  
  21.         /* time to quit? */
  22.         when (upper(cmd) = "Q") then do
  23.             leave
  24.         end
  25.  
  26.         /* need some help? */
  27.         when (cmd = "?") then do
  28.             writeln('console', 'Enter "<command> ?" to obtain a command''s template.')
  29.             writeln('console', 'Enter "HELP <command>" to obtain more help on a command.')
  30.             writeln('console', 'Enter "Q" or "Quit" to exit command shell.')
  31.             writeln('console', 'Enter "REXX <command>" to execute rexx commands.')
  32.         end
  33.  
  34.         /* do nothing on empty lines */
  35.         when (cmd = "") then do
  36.             nop
  37.         end
  38.  
  39.         /* whatsinaline */
  40.         otherwise do
  41.  
  42.             /* if the commandstring starts with "rexx " interpret it as a rexx
  43.                 instruction instead of a command */
  44.             if upper(left(cmd,5)) = "REXX " then do
  45.                 interpret right(cmd,length(cmd) - 5)
  46.             end
  47.  
  48.             else do
  49.                 /* execute the command string */
  50.                 cmd
  51.  
  52.                 /* if ok show the result, if any */
  53.                 if RC == 0 then do
  54.                     if result ~= "RESULT" then writeln('console', result)
  55.                     if (upper(cmd) = "QUIT") then leave
  56.                 end
  57.  
  58.                 else do
  59.                     /* ERROR!!!!   get fault string from MCEd */
  60.                     writeln('console', '*** Error');
  61.                 end
  62.             end
  63.         end
  64.     end
  65. end
  66.  
  67. exit(0)
  68.